<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('downs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->index()->default(0)->comment('申请人ID');
            $table->unsignedBigInteger('role_id')->index()->default(0)->comment('部门ID');
            $table->unsignedBigInteger('handled_id')->index()->default(0)->comment('经办人');
            $table->unsignedBigInteger('project_id')->default(0)->index();
            $table->string('cert_id')->nullable()->comment('证书ID');
            $table->string('purpose')->default('/')->comment('用途');
            $table->date('apply_date')->nullable()->comment('申请时间');
            $table->date('end_date')->nullable()->comment('结束时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('downs');
    }
};
